package com.ruoyi.tjbb.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.tjbb.domain.SysTjbbDdjl;
import com.ruoyi.tjbb.service.ISysTjbbDdjlService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 调度记录Controller
 * 
 * @author ruoyi
 * @date 2023-09-26
 */
@RestController
@RequestMapping("/tjbb/sjcx/ddjl")
public class SysTjbbDdjlController extends BaseController
{
    @Autowired
    private ISysTjbbDdjlService sysTjbbDdjlService;

    /**
     * 查询调度记录列表
     */
    @PreAuthorize("@ss.hasPermi('tjbb/sjcx:ddjl:list')")
    @GetMapping("/list")
    public TableDataInfo list(SysTjbbDdjl sysTjbbDdjl)
    {
        startPage();
        List<SysTjbbDdjl> list = sysTjbbDdjlService.selectSysTjbbDdjlList(sysTjbbDdjl);
        return getDataTable(list);
    }

    /**
     * 导出调度记录列表
     */
    @PreAuthorize("@ss.hasPermi('tjbb/sjcx:ddjl:export')")
    @Log(title = "调度记录", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, SysTjbbDdjl sysTjbbDdjl)
    {
        List<SysTjbbDdjl> list = sysTjbbDdjlService.selectSysTjbbDdjlList(sysTjbbDdjl);
        ExcelUtil<SysTjbbDdjl> util = new ExcelUtil<SysTjbbDdjl>(SysTjbbDdjl.class);
        util.exportExcel(response, list, "调度记录数据");
    }

    /**
     * 获取调度记录详细信息
     */
    @PreAuthorize("@ss.hasPermi('tjbb/sjcx:ddjl:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(sysTjbbDdjlService.selectSysTjbbDdjlById(id));
    }

    /**
     * 新增调度记录
     */
    @PreAuthorize("@ss.hasPermi('tjbb/sjcx:ddjl:add')")
    @Log(title = "调度记录", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody SysTjbbDdjl sysTjbbDdjl)
    {
        return toAjax(sysTjbbDdjlService.insertSysTjbbDdjl(sysTjbbDdjl));
    }

    /**
     * 修改调度记录
     */
    @PreAuthorize("@ss.hasPermi('tjbb/sjcx:ddjl:edit')")
    @Log(title = "调度记录", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody SysTjbbDdjl sysTjbbDdjl)
    {
        return toAjax(sysTjbbDdjlService.updateSysTjbbDdjl(sysTjbbDdjl));
    }

    /**
     * 删除调度记录
     */
    @PreAuthorize("@ss.hasPermi('tjbb/sjcx:ddjl:remove')")
    @Log(title = "调度记录", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(sysTjbbDdjlService.deleteSysTjbbDdjlByIds(ids));
    }
}
